/*
 * main.c
 *
 * TV Output for Arduino
 *
 * Based on Nigel Batten's TellyMate notes and code available at
 *  http://www.batsocks.co.uk/readme/art_SerialVideo_1.htm
 *
 * Copyright (c) 2010, Alan Green.
 * Contactable at <firstname>.<lastname>@gmail.com
 *
 * Copyright (c) 2009, Nigel Batten.
 * Contactable at <firstname>.<lastname>@mail.com
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 	1.	Redistributions of source code must retain the above copyright
 * 		notice, this list of conditions and the following disclaimer.
 * 	2.	Redistributions in binary form must reproduce the above copyright
 * 		notice, this list of conditions and the following disclaimer in the
 * 		documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
 * OF SUCH DAMAGE.
 *
 * ===============================================
 */

/*
 * Circuitry:
 *
 * PB1 (OC1A, D9) -> Diode -> 1k Ohm resistor -> RCA plug tip
 * PB3 (MOSI, D11) -> Diode -> 330 Ohm resistor -> RCA plug tip
 * RCA plug outer -> GND
 *
 */

#include "display.h"
#include "test.h"
#include "pong.h"
#include "fixmath/fixed.h"


// Main routine setup, then sync/render all day long
int __attribute__((OS_main)) main(void) {
    init();
//    frame_logic = bounce_function;
//    frame_logic = test_diagonal_function;
//    frame_logic = text_function;
    volatile Fixed x = fix_sin(FC(0.1), FC(0.5));
    pong_init();
//    init_input_test();
    display_loop();
    return 0;
}

